<template>
  <div>
    <div>MyMessage</div>
    <div @click="clickInfo">子组件 == {{ name1 }}, {{ title1 }}</div>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from "vue";

export default defineComponent({
  name: "MyMessage",
  props: ["name", "title"],
  setup(props, context) {
    const name1 = ref(props.name);
    const title1 = ref(props.title);
    // 子组件点击事件
    const clickInfo = () => {
      // 抛出事件
      context.emit("itemclick", { name: "emitClick" });
    };
    return { name1, title1, clickInfo };
  },
});
</script>

<style lang="scss" scoped>
</style>